<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>第二题</title>
</head>

<body>
    <script>
        let num = 0
        let arr = [45, 12, 20, 46, 78, 11]
        for (let i = 0; i < arr.length; i++) {
            if (arr[i] === 10) {
                console.log(arr[i])
                document.write(arr[i])
                num++
            }
        }
        if (num > 0) {
            alert(2)
        } else if (num === 0) {
            alert(- 1)
        }
    </script>
</body>

</html>